Skip to main content

Update API Rate Limit

Used to update the rate limiting configuration for an API tool. Rate limiting helps prevent abuse, manage API costs, and ensure fair usage across multiple requests.

API Endpoint

PropertyValue
Request MethodPOST
Request URLhttps://api.seliseblocks.com/tools/api-rate-limit/{tool_id}

Request

Request Example

curl -X POST 'https://api.seliseblocks.com/tools/api-rate-limit/tool_weather_api' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"Enabled": true,
"RequestsPerMinute": 100,
"RequestsPerHour": 6000,
"BurstSize": 10
}'

Request Headers

FieldTypeRequiredDescription
acceptstringYesAccepted response format. Use application/json
Content-Typeapplication/jsonYesData type, must be application/json.

Path Parameters

FieldTypeRequiredDescription
tool_idstringYesUnique identifier of the API tool to configure rate limiting for.

Request Body

Request Body Schema

{
"Enabled": false,
"RequestsPerMinute": 100,
"RequestsPerHour": 6000,
"BurstSize": 10
}

Request Body Parameters

FieldTypeRequiredDescription
EnabledbooleanYesWhether rate limiting is enabled for this tool.
RequestsPerMinuteintegerNoMaximum number of requests allowed per minute. Default: 100.
RequestsPerHourintegerNoMaximum number of requests allowed per hour. Default: 6000.
BurstSizeintegerNoNumber of requests allowed in a burst. Default: 10.
tip

Understanding Rate Limit Parameters

RequestsPerMinute: Controls short-term traffic to prevent spam or accidental overuse. If you expect quick bursts of activity, set this higher.

RequestsPerHour: Controls long-term usage to stay within API provider limits and manage costs. This is your primary throttle for overall usage.

BurstSize: Allows temporary spikes above the per-minute limit. For example, if RequestsPerMinute is 60 and BurstSize is 10, the system can handle 70 requests in a single minute, but subsequent minutes will be throttled until the average drops below 60/min.

Example Scenarios:

  • High-frequency API: RequestsPerMinute: 300, RequestsPerHour: 10000, BurstSize: 50
  • Standard API: RequestsPerMinute: 100, RequestsPerHour: 6000, BurstSize: 10
  • Rate-sensitive API: RequestsPerMinute: 10, RequestsPerHour: 500, BurstSize: 2
  • Free tier API: RequestsPerMinute: 5, RequestsPerHour: 100, BurstSize: 1

Response

Success Response (200 OK)

Returns an object containing the rate limit configuration update status.

{
"is_success": true,
"item_id": "tool_weather_api",
"detail": "API rate limit configuration updated successfully",
"error": {}
}

Response Fields

FieldTypeDescription
is_successbooleanIndicates whether the operation was successful.
item_idstringUnique identifier of the tool that was configured.
detailstringSuccess or failure message with additional context.
errorobjectError details if the operation failed (empty if successful).

Example Configurations

High-Volume API

{
"Enabled": true,
"RequestsPerMinute": 500,
"RequestsPerHour": 20000,
"BurstSize": 100
}

Use case: Internal APIs with high availability and no strict cost constraints

Standard Production API

{
"Enabled": true,
"RequestsPerMinute": 100,
"RequestsPerHour": 6000,
"BurstSize": 10
}

Use case: Typical third-party API with moderate usage limits

Cost-Sensitive API

{
"Enabled": true,
"RequestsPerMinute": 20,
"RequestsPerHour": 1000,
"BurstSize": 5
}

Use case: Expensive APIs where you need to carefully control costs

Free Tier API

{
"Enabled": true,
"RequestsPerMinute": 5,
"RequestsPerHour": 100,
"BurstSize": 2
}

Use case: Free tier APIs with strict rate limits

Development/Testing

{
"Enabled": false,
"RequestsPerMinute": 1000,
"RequestsPerHour": 50000,
"BurstSize": 100
}

Use case: Development environment where rate limiting is disabled or very permissive

Error Response (422 Unprocessable Entity)

Returns validation error details when the request body is invalid.

{
"detail": [
{
"loc": [
"body",
"RequestsPerMinute"
],
"msg": "ensure this value is greater than 0",
"type": "value_error.number.not_gt"
}
]
}

Error Response Fields

FieldTypeDescription
detailarrayArray of validation error objects.
locarrayLocation of the error in the request (e.g., path, body).
msgstringHuman-readable error message.
typestringError type identifier.

Error Codes

Status CodeDescriptionResponse Type
200Successful ResponseSuccess
400Bad Request - Invalid rate limit configurationBad Request
404Not Found - Tool does not existNot Found
422Validation Error - Invalid request parametersUnprocessable Entity
warning

Rate Limiting Best Practices

Align with API Provider Limits: Set your rate limits below the API provider's limits to avoid hitting their restrictions.

Monitor Usage: Track actual API usage patterns to optimize rate limit settings.

Handle Rate Limit Errors: Implement proper error handling and retry logic with exponential backoff when rate limits are hit.

User Communication: If rate limits affect user experience, communicate clearly about limitations and wait times.

Gradual Rollout: Start with conservative limits and gradually increase based on observed behavior and needs.

Cost Management: Set rate limits that align with your budget for paid APIs.

note

Rate Limit Enforcement

  • Rate limits are enforced per tool, not per agent or user
  • Requests exceeding the limit will receive a 429 (Too Many Requests) error
  • The system uses a sliding window algorithm to track request counts
  • Burst capacity allows temporary spikes but is recovered over time
  • Disabling rate limiting (Enabled: false) removes all throttling for the tool